﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace LiskovSubstitutionLibrary
{
    public class Purity3
    {
        public object Property { get; set; }

        public void ModifyingMethod(object value)
        {
            Console.WriteLine(value);
            Property = value;
        }

        public void MethodWithRef(ref int ulli)
        {
            Console.WriteLine(ulli);
        }

        public int CallFunctional(IList<Purity2> list)
        {
            var firstOrDefault = list.FirstOrDefault(x => x.Property == x.Property2);
            var array = (from x in list where x.Property2 != null select x.Property2.ToString().Length).ToArray();
            return array.Sum() + (firstOrDefault == null ? 0 : 1);
        }
    }
}